// index.js
// 获取应用实例
const App = getApp()
const api = require('../../utils/requst.js').API;
Page({
  data: {
    top:0,
    tlist:['酒店亮点','设施服务','酒店介绍'],
    tindex:0,
    id:'',
    info:{}
  },
  onLoad(e) {
    let top =38+App.globalData.systemInfo.statusBarHeight + App.globalData.menuButton.height + (App.globalData.menuButton.top - App.globalData.systemInfo.statusBarHeight)*2
    console.log(top)
    this.setData({top:top,id:e.id})
    api.getPageHotelList({id:e.id}).then(res=>{
      var list = res.data.data.records[0]
      this.setData({info:list})
    })
  },
  collet(){
    api.saveCollect({collectType:2,hotelId:this.data.id,id:this.data.id,userId:wx.getStorageSync('token')}).then(res=>{
      wx.showToast({
        title: '收藏成功',  // 标题
        icon: 'success',   // 图标类型，默认success
        duration: 1500   // 提示窗停留时间，默认1500ms
    })
    })
  },
  toggleIndex(e){
    var index = e.currentTarget.dataset.index
    this.setData({tindex:index})
  },
  callPhone(){
    wx.makePhoneCall({
      phoneNumber: this.data.info.hotelServicePhone
    })
  },
  onReady: function (e) {
    
  },
  markertap(e) {
   
  },
})
